package com.baby.movie.widget;

import com.baby.movie.R;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class CActionBar extends RelativeLayout {
	
	private ImageView mIvLogo;
	
	private ImageView mIvSearch;
	
	private TextView mTvTitle;
	
	private OnClickListener mSearchClickListener;

	public CActionBar(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		init();
	}

	public CActionBar(Context context, AttributeSet attrs) {
		super(context, attrs);
		init();
	}

	public CActionBar(Context context) {
		super(context);
		init();
	}
	
	private void init() {
		LayoutInflater.from(getContext()).inflate(R.layout.actionbar, this, true);
		mIvLogo = (ImageView) findViewById(R.id.ivLogo);
		mIvSearch = (ImageView) findViewById(R.id.ivSearch);
		mTvTitle = (TextView) findViewById(R.id.tvTitle);
		
		mIvSearch.setOnClickListener(mSearchClickListener);
	}
	
	public void setLogo(Drawable drawable) {
		mIvLogo.setImageDrawable(drawable);
	}
	
	public void setLogo(int resid) {
		mIvLogo.setImageResource(resid);
	}
	
	public void setTitle(CharSequence text) {
		mTvTitle.setText(text);
	}
	
	public void setTitle(int resid) {
		mTvTitle.setText(resid);
	}

}
